#1,spec option 序列化器
from rest_framework import serializers
from goods.models import SpecificationOption, SPUSpecification


class SpecsOptionSerializer(serializers.ModelSerializer):

    #1,重写spec
    spec = serializers.StringRelatedField(read_only=True)
    spec_id = serializers.IntegerField()

    class Meta:
        model = SpecificationOption
        fields = "__all__"



#2,spec规格信息
class SpecSimpleSerializer(serializers.ModelSerializer):
    class Meta:
        model = SPUSpecification
        fields = ("id","name")